package com.project.service.impl;

import com.project.bean.CutPageBean;
import com.project.bean.ThemeBean;
import com.project.dao.ICommentDao;
import com.project.dao.IThemeDao;
import com.project.service.IThemeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
@SuppressWarnings("all")
@Service
public class ThemeServiceImpl implements IThemeService {
    @Autowired
    private IThemeDao  dao;
    @Autowired
    ICommentDao commentDao;
    @Override
    public CutPageBean<ThemeBean> findByItem(int pageNO, Integer channelId, String name, String username, LocalDate startDate, LocalDate endDate) {
        return dao.findByItem(pageNO, channelId, name, username, startDate, endDate);
    }

    @Override
    public void add(ThemeBean theme) {
        dao.add(theme);
    }

    @Override
    public ThemeBean findById(Integer id) {
        ThemeBean theme = dao.findById(id);
        theme.setList(commentDao.findByTheme(id));
        return theme;
    }
}
